{% extends "base.html" %}
{% load i18n %}
{% block title %} Tu Negocio Empresarios - Ver Flujo de Caja{% endblock %}
{% block head-css-ext %}
    <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/layout.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/blue/style.css" media="print, projection, screen" />
{% endblock %}

{% block head-js-ext %}
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.tablesorter.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.tablePagination.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.translate.js"></script>
{% endblock %}

{% block head-js-embedded %}
    <script type="text/javascript">
        $(document).ready(function(){
            var options = {
                firstArrow : (new Image()).src="{{MEDIA_URL}}img/icons/first.png",
                prevArrow : (new Image()).src="{{MEDIA_URL}}img/icons/prev.png",
                lastArrow : (new Image()).src="{{MEDIA_URL}}img/icons/last.png",
                nextArrow : (new Image()).src="{{MEDIA_URL}}img/icons/next.png"
            }	  
            $("#caja")		
                .tablesorter({widthFixed: true,  widgets: ['zebra'], headers: { 2:{sorter: false}, 3:{sorter: false}, 4:{sorter: false}  }})
                .tablePagination(options);		
            $("#tablePagination").translate('en', 'es');	  
        });        
    </script>
{% endblock %}

{% block content-box1 %}
    Flujo de Caja de: {{ usuario.first_name }} {{ usuario.last_name }}
    {% if flujo_caja %}   
        <table id="caja" class="tablesorter">
            <thead>
                <tr align="center">
                    <th>Fecha</th>
                    <th>Descripción</th>
                    <th>Haber</th>
                    <th>Debe</th>
                    <th>Saldo</th>
                </tr>            
            </thead>
            <tbody>
                {% for caja in flujo_caja %}               
                    <tr align="center">
                        <td>{{ caja.fecha|date:"d M Y" }}</td>
                        <td>{{ caja.descripcion }}</td>
                        {% ifequal caja.haber 0 %}
                            <td></td>
                        {% else %}
                            <td>{{ caja.haber }}</td>
                        {% endifequal %}
                        {% ifequal caja.debe 0 %}
                            <td></td>
                        {% else %}
                            <td>{{ caja.debe }}</td>
                        {% endifequal %}
                        <td>{{ caja.saldo }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>   
    {% else %}
        <p><b>No tiene actualmente nada registrado en su flujo de caja</b></p>
    {% endif %}
{% endblock %}
{% block content-colum2 %}
    {% if user.is_authenticated %}
        <ul>
            <li><a href="{% url index %}">{% trans "Home" %}</a></li>
            <li><a href="{% url flujo_caja %}">Flujo de Caja</a></li>
        </ul>
    {% endif %}   
{% endblock %}